# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=dsstore-crawler
pkgver=7.efa51f5
pkgrel=5
pkgdesc='A parser + crawler for .DS_Store files exposed publically.'
arch=('any')
groups=('blackarch' 'blackarch-webapp' 'blackarch-recon')
url='https://github.com/anantshri/DS_Store_crawler_parser'
license=('Apache')
depends=('python' 'python-argparse' 'python-ds-store' 'python-mac-alias'
         'python-urllib3' 'python-requests')
makedepends=('git')
source=("$pkgname::git+https://github.com/anantshri/DS_Store_crawler_parser.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE

  rm README.md LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
python dsstore_crawler.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

